package com.easylinkin.linkappapi.circuit.dto;
/**
 * 断路器故障类型枚举
 */
public enum FaultCodeTypeEnum {
    /**
     * 过压
     */
    OVERVOLTAGE("Err_HV","过压"),
    /**
     *欠压
     */
    UNDERVOLTAGE("Err_LV","欠压"),
    /**
     *过流
     */
    OVERCURRENT("Err_HC","过流"),
    /**
     * 过温
     */
    OVER_TEMPERATURE("Err_HT","过温"),
    /**
     * 漏电
     */
    LEAKAGE_OF_ELECTRICITY("Err_LEAK","漏电"),
    /**
     *电弧故障
     */
    ARC_FAULT("Err_ARC","电弧故障"),
    /**
     *瞬时故障
     */
    TRANSIENT_FAULT("Err TRANS","瞬时故障"),
    /**
     *缺相故障
     */
    PHASE_LOSS_FAULT("Err_OPEND","缺相故障");
    /**
     * 报警代码
     */
    String code;
    /**
     * 报警名称
     */
    String name;

    FaultCodeTypeEnum( String code,String name) {
        this.name = name;
        this.code = code;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
    public static FaultCodeTypeEnum getEnumByCode(String code){
        FaultCodeTypeEnum[] values = FaultCodeTypeEnum.values();
        for (FaultCodeTypeEnum e:values){
           if (e.getCode().equals(code)){
               return e;
           }
        }
        return null;
    }
}
